Skip to content

Fix missing grant_type in Authress token exchange; stop guessing on exchange failures - #11

Merged
wparad merged 1 commit into
mainfrom
claude/grant-type-login-flow-gco0dv
Aug 19, 2026
Merged

Fix missing grant_type in Authress token exchange; stop guessing on exchange failures#11
wparad merged 1 commit into
mainfrom
claude/grant-type-login-flow-gco0dv

Conversation

@wparad

@wparad wparad commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The token exchange body (POST /authentication/{id}/tokens) never sent grant_type or client_id, and used camelCase field names (codeVerifier, redirectUri). Cross-checked against @authress/login's own minified source: this is the one endpoint in the SDK that's OAuth-shaped and expects grant_type=authorization_code, client_id, code_verifier, redirect_uri (snake_case). Authress was rejecting the exchange outright — this is the source of the "grant type" error on login.
  • The exchange's error handling assumed any sub-500 status meant "code already redeemed" and silently treated it as a successful login, without checking whether a session actually existed and without logging what the failure actually was. Now every exchange failure is logged with its real status/body at ERROR level, and is only treated as harmless once a session cookie is verifiably present (an objective check, not a guess from the status code) — otherwise it surfaces as a real error via authError instead of silently bouncing the user back to the login screen.

Test plan

  • Manual sign-in against a live Authress backend to confirm the token exchange now succeeds
  • Confirm a genuinely failed exchange now shows a real error on LoginScreen instead of silently resetting to "Continue"
  • Not build-verified in this session — the Gradle wrapper jar is not present in this environment (pre-existing, unrelated to this change)

Generated by Claude Code

The token exchange body never sent grant_type or client_id and used
camelCase field names, while /authentication/{id}/tokens is the one
OAuth-shaped endpoint in this SDK and expects grant_type=authorization_code,
client_id, code_verifier, redirect_uri (snake_case) — confirmed against
@authress/login's own minified source. Authress was rejecting the exchange
outright, which explains the "grant type" error on login.

Separately, the exchange's error handling assumed any sub-500 status meant
"code already redeemed" and silently treated it as a successful login
without checking whether a session actually existed, and without logging
what the failure actually was — just a guessed explanation. Now every
exchange failure is logged with its real status/body, and is only treated
as harmless once a session cookie is verifiably present; anything else
surfaces as a real error via authError instead of silently resetting to
the login screen.
@wparad
wparad merged commit 1627634 into main Aug 19, 2026
2 checks passed
@wparad
wparad deleted the claude/grant-type-login-flow-gco0dv branch August 19, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants